import request  from "../request.js"

const Api = {
    page: '/admin/order-grabbing/page?',
    delete: '/admin/order-grabbing/delete/id=',
    editOrSave: '/admin/order-grabbing/update',
    orderId: '/admin/order-grabbing=',
    batch: '/admin/order-grabbing/batchd_delete'
}


/**
 * 分页获取抢单信息
 * @param object 查询参数
 * @return {AxiosPromise}
 */
export function getPageOrderGrabbing(param){
    return request({
        url: Api.page,
        method: 'GET',
        params: param
    })
}

/**
 * 根据id删除抢单信息
 * @param id int 订单id
 * @return {AxiosPromise}
 */
export function deleteOrderGrabbingById(id) {
    return request({
        url: Api.delete+id,
        method: 'GET'
    })
}

/**
 * 批量删除抢单信息
 * @ids  array id数组
 * @return {AxiosPromise}
 */
export function batchDeleteOrderGrabbingInfo(ids){
    return request({
        url: Api.batch,
        method: 'post',
        data: ids
    })
}

/**
 * 修改或保存抢单信息
 * @orderinfo  object 抢单信息
 * @return {AxiosPromise}
 */
export function editOrSaveOrderGrabbingInfo(orderinfo){
    return request({
        url: Api.editOrSave,
        method: 'post',
        data: orderinfo
    })
}